import Vue from 'vue'
import VueRouter from 'vue-router'
import layoutIndex from '../layout/layoutIndex.vue'
import subapplication from './subapplication'

Vue.use(VueRouter)

const routes = [
  // 主应用
  {
    path: '/',
    redirect:'/indexPage'
  },
  {
    path: '/indexPage',
    name: 'indexPage',
    component: () => import('@/views/indexPage.vue')
  },
  {
    path: '/home',
    name: 'home',
    redirect: '/gamesBox',
    component: layoutIndex,
    children:[
      {
        path: '/gamesBox',
        name: 'gamesBox',
        component: () => import('@/views/gamesBox.vue')
      },
    ],
  },
  // 子应用
  ...subapplication,
  { 
    path: '*',
    redirect: '/404'
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404.vue')
  },
]

const router = new VueRouter({
  mode: "history",
  // base: process.env.BASE_URL,
  routes
})

export default router
